<?php

namespace app\admin\model;

use think\Model;

/**
 * Order
 */
class Order extends Model
{
    // 表名
    protected $name = 'order';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 字段类型转换
    protected $type = [
        'pay_time' => 'timestamp:Y-m-d H:i:s',
        'send_time' => 'timestamp:Y-m-d H:i:s',
        'take_time' => 'timestamp:Y-m-d H:i:s',
    ];




    public function getPayAmountAttr($value): float
    {
        return (float)$value;
    }




    public function member(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Member::class, 'member_id', 'id');
    }
}